﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Basics
{
    class Basics
    {
        static void Main(string[] args)
        {
            //this is a comment - it's not executable code

            //this is our first code
            //Console.WriteLine("Hello World!");
            //our first method
            //WritePressKey();

            //more methods
            //PrintMyName();
            //CalculateSomething();
            //CalculateGame();

            //simple class example
            SimpleClassExample();
        }

        /// <summary>
        /// writes "please press key to continue"
        /// </summary>
        private static void WritePressKey()
        {
            Console.WriteLine("please press key to continue");
            Console.ReadKey();
        }

        /// <summary>
        /// writes the entered value
        /// </summary>
        private static void PrintMyName()
        {
            Console.WriteLine("Hi, what's your name?");
            string myname = Console.ReadLine();
            Console.WriteLine("Hello " + myname);
            WritePressKey();
        }

        /// <summary>
        /// generates math question and checkes your entry
        /// </summary>
        /// <returns>returns if your entry was true or false</returns>
        private static bool CalculateSomething()
        {
            Random random = new Random();
            int x = random.Next(100);
            int y = random.Next(100);
            //int x = 7;
            //int y = 3;
            //z = x + y;

            Console.WriteLine("solve: " + x + " + " + y);
            int z = int.Parse(Console.ReadLine());

            if (z == x + y)
            {
                Console.WriteLine("correct!");
                return true;
            }
            else
            {
                Console.WriteLine("not quite right!");
                return false;
            }

            WritePressKey();
        }

        /// <summary>
        /// generates x math questions and shows you your score
        /// </summary>
        private static void CalculateGame()
        {
            Random random = new Random();
            int rounds = 10;
            int score = 0;

            Console.WriteLine("How many rounds?");
            rounds = int.Parse(Console.ReadLine());

            for (int i = 0; i < rounds; i++)
            {
                if (CalculateSomething())
                {
                    score++;
                }
            }
            Console.WriteLine("Score: " + score + "/" + rounds);
            WritePressKey();
        }

        /// <summary>
        /// how to use classes
        /// </summary>
        private static void SimpleClassExample()
        {
            Console.WriteLine("-----------\nCompany XZY\n-----------");
            //Employee myEmployee1 = new Employee("Jane", "Doe", "IT");
            Person myPerson = new Person("Mintra","Mitchell");
            //myPerson.Age = 12;
            Console.WriteLine(myPerson.ShowDetails());


            //Console.WriteLine(myEmployee1.ShowDetails());
            //Console.WriteLine(myEmployee1.Eat("apple"));
            //Console.WriteLine(myEmployee1.TypeCode());
            //Employee myEmployee2 = new Employee("John", "Smith", "Accounting");
            //Console.WriteLine(myEmployee2.ShowDetails());
            WritePressKey();
        }
    }
}
